%!PS-Adobe-3.0
%%Title: Diplomacy Map
%%Creator: dpmap, using a map created with DPeye
%%DocumentPaperSizes: Letter
%%LanguageLevel: 2
%%Orientation: Landscape
%%Pages: (atend)
%%DocumentNeededResources: font Helvetica-Bold Courier Courier-Bold Times-Roman
%%+ font Helvetica
%%EndComments

%%BeginDefaults
%%PageResources: font Helvetica-Bold Courier Courier-Bold Times-Roman Helvetica
%%EndDefaults

% INFO
% MAP

%%BeginSetup
%<Play Setup /$RetreatColor ArrowRed /$BuildRays 16 /$ProposeColor ArrowWhite>
%<+ /$FogWaveLength 12 /$HalfSlashThickness 5 /$SpaceChar 32 /$PaintScaleFactor>
%<+ 1 /$MoveColor ArrowBlack /$MapUnitScale $MapDrawingScale>
%<+ /$FixedFontHeightRatio 1 /$MapNumberScale $MapDrawingScale /$BuildRadius 24>
%<+ /$HeadLength 20 /$MoveRadius 8 /$FrameMargin { $FrameThickness>
%<+ $FrameMarginRatio mul } /$MapUnitLetterSize 14 /$TextFontWidthRatio>
%<+ $FixedFontWidthRatio /$ArrowShaftLength 40 /$MapImageLeft 0 /$PageHeight>
%<+ 612 /$MapImageRight 211 /$SwitchToMapMode SwitchToMapMode /$FindFont>
%<+ findfont /$Pi 3.14159 /$InitModes { /FinishReport { } def /InTextMode true>
%<+ def } /$MapUnitOffsetX 0 /$TextFontHeight { $TextFontHeightRatio>
%<+ $TextFontSize mul } /$MapUnitOffsetY 8 /$MapNameOffsetX 0>
%<+ /$FixedFontWidthRatio .6 /$ArrowLineThickness 1 /$MapNameOffsetY -14>
%<+ /$BuildRayFraction {1 3 div} /$TextFontHeightRatio $FixedFontHeightRatio>
%<+ /$PageWidth 792 /$ArrowBase 0 /$AbsoluteRoundingError 0 /$HalfSlashLength>
%<+ 16 /$HalfHeadThickness 5 /$MapImageWidth {$MapImageRight $MapImageLeft sub}>
%<+ /$MaxNumberLength 4 /$MapNameFontSize 14 /$MapImageTop 239>
%<+ /$FogWaveRaiseHeight 3 /$FogWaveRaiseLength 4 /$ConvoyRadius 12>
%<+ /$DiscoverColor ArrowBlue /$HalfThickness 1 /$FogWaveDistance 8>
%<+ /$ArrowRotate {} /$MapNumberSize 14 /$FogWaveThickness 4 /$MapSupplyScale>
%<+ $MapDrawingScale /$TextFontWidth {$TextFontWidthRatio $TextFontSize mul}>
%<+ /$MapImageBottom 0 /$HoldRadius 24 /$MapNameScale $MapUnitScale>
%<+ /$BuildColor ArrowWhite /$FrameThickness 4 /$BuildRayThickness 6>
%<+ /$FrameMarginRatio .5 /$FinishModes { InTextMode { FinishReport } { r }>
%<+ ifelse } /$MapImageHeight {$MapImageTop $MapImageBottom sub}>
%<+ /$MapDrawingScale .3>

%<Play Definitions>

%<Act Shorthand>
/bd { bind def } bind def
/xd { exch def } bd
/ld { load def } bd
%</Act>

%<Sketch Math>
%$ /ifloor { $AbsoluteRoundingError add floor cvi } bd
/ifloor { .001 add floor cvi } bd
%$ /iceiling { $AbsoluteRoundingError sub ceiling cvi } bd
/iceiling { .001 sub ceiling cvi } bd
/min { 2 copy gt { exch } if pop } bd
/max { 2 copy lt { exch } if pop } bd
/secure_atan { 2 copy 0 eq exch 0 eq and { pop pop 0 } { atan } ifelse } bd
/center { 3 2 roll add 2 div 3 1 roll add 2 div exch } bd
%</Sketch>

%<Scene PaintOperators /operator ld /format {name name}>
/a /arc ld
/c /curveto ld
/d /setdash ld
/f /fill ld
/h /show ld
/k /stroke ld
/l /lineto ld
/m /moveto ld
/n /newpath ld
/o /rotate ld
/p /closepath ld
/r /grestore ld
/s /gsave ld
/t /translate ld
/w /setlinewidth ld
/x /scale ld
/y /scalefont ld
/z /setfont ld
%</Scene>

%<Act Powers>
/Powers 20 dict def
%</Act>

%<Sketch MapUnitDefinitions>
%%IncludeResource: font Helvetica-Bold
%$ /MapUnitLetterFont /Helvetica-Bold $FindFont $MapUnitLetterSize y def
/MapUnitLetterFont /Helvetica-Bold findfont 14 y def
%</Sketch>

%<Sketch MapNameDefinitions>
%%IncludeResource: font Helvetica-Bold
%$ /MapNameFont /Helvetica-Bold $FindFont $MapNameFontSize y def
/MapNameFont /Helvetica-Bold findfont 14 y def
%</Sketch>

%<Sketch TextColumnDefinitions>
%%IncludeResource: font Courier
%$ /TextFixedFont /Courier $FindFont def
/TextFixedFont /Courier findfont def
%</Sketch>

%<Sketch TextHeadingDefinitions>
%%IncludeResource: font Courier-Bold
%$ /TextHeadingFont /Courier-Bold $FindFont def
/TextHeadingFont /Courier-Bold findfont def
%</Sketch>

%<Sketch TextTitleDefinitions>
%%IncludeResource: font Times-Roman
%$ /TextTitleFont /Times-Roman $FindFont def
/TextTitleFont /Times-Roman findfont def
%</Sketch>

%<Sketch MapNumberDefinitions>
%%IncludeResource: font Helvetica
%$ /MapNumberFont /Helvetica $FindFont $MapNumberSize y def
/MapNumberFont /Helvetica findfont 14 y def
%</Sketch>

%</Play>

%<Play Chapters /references {() PageLayout MapImageScale} /define bd>

%<Chapter PageSetup>
/PageSetup {

%<Sketch TurnLandscape>
	%$ $PageHeight 0 t
	612 0 t
	90 o
%</Sketch>

%<Sketch SetupGState>
	%$ $InitModes
	/FinishReport { } def /InTextMode true def
	Black
	MovePhase
%</Sketch>

} bd
%</Chapter>

%<Chapter ShowPage>
/ShowPage {
	DrawAliases
	%$ $FinishModes
	InTextMode { FinishReport } { r } ifelse

%<Part none/>

	showpage
} bd
%</Chapter>

%<Chapter VisitColors /define def>
/VisitColors {
	3 dict begin
	/c xd /r xd /g xd

%<Scene GrayColors /operator g /format {name 1}>
	/BorderBlack .1 g
	/MountainGrey .5 g
	/IceGrey .9 g
	/ArrowBlack 0 g
	/ArrowWhite .9 g
	/Black 0 g
	/White .9 g
%</Scene>

%<Scene RGBColors /operator r /format {name 3}>
	/LandBrown .8 .7 .4 r
	/SeaBlue .1 .4 .6 r
	/ArrowRed 1 0 0 r
	/ArrowBlue .529 .808 .922 r
	/Blue 0 0 1 r
	/Yellow 1 1 0 r
	/Brown .6 .45 .2 r
%</Scene>

%<Scene CMYKColors /operator g /format {name 1}/>

	end
} def
%</Chapter>

%<Chapter VisitPowers /define def>
/VisitPowers {
	1 dict begin
	/p xd

%<Scene Powers /operator p /format {uname ustring name name}>
	/UNOWNED (?) /Brown /White p
%</Scene>

	end
} def
%</Chapter>

%<Chapter Controls>
/Controls {

%<Act Controls>
	/ChangeController true def
%</Act>

} bd
%</Chapter>

%<Chapter DrawFleet /$StrokeUnit { Controlled { s 6 $PaintScaleFactor div w>
%<+ Outer k r } if 2 $PaintScaleFactor div w Contrast k } /$FillUnit {Paint f}>
/DrawFleet {
	%$ $SwitchToMapMode
	SwitchToMapMode
	Power begin
	s t

%<Sketch LocateTroop>
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
%</Sketch>

%<Sketch PaintFleet>
	-26 -7 m -26 -2 l -19 -2 l -19 -1 l % to bow
	-22 -1 l -22 0 l -15 0 l -15 1 l % A turret
	-18 1 l -18 2 l -10 2 l -10 0 l % B turret
	-9 0 l -9 4 l -8 4 l -8 6 l % conn tower
	-6 6 l -6 5 l -5 5 l -5 9 l % Infra struct
	-3 9 l -3 14 l -2 14 l -2 9 l % funnel 1
	0 9 l 0 5 l 1 5 l 1 8 l % funnel 2
	3 8 l 3 13 l 4 13 l 4 8 l % mast 2
	6 8 l 6 0 l 8 0 l 8 2 l % funnel 2
	16 2 l 16 1 l 13 1 l 13 0 l % C turret
	20 0 l 20 -1 l 17 -1 l 17 -2 l % D turret
	23 -2 l 23 -3 l 25 -3 l 25 -5 l % stern
	24 -5 l 24 -7 l p
	%$ s $StrokeUnit r $FillUnit
	s Controlled { s 6 w Outer k r } if 2 w Contrast k r Paint f
%</Sketch>

%<Act PaintLetter>
	Offset aload pop m
	MapUnitLetterFont z
	Contrast Letter h
%</Act>

	r
	end
} bd
%</Chapter>

%<Chapter DrawArmy /$StrokeUnit { Controlled { s 6 $PaintScaleFactor div w>
%<+ Outer k r } if 2 $PaintScaleFactor div w Contrast k } /$FillUnit {Paint f}>
/DrawArmy {
	%$ $SwitchToMapMode
	SwitchToMapMode
	Power begin
	s t

%<Sketch LocateTroop>
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
%</Sketch>

%<Sketch PaintArmy>
	n 0 0 9 0 360 a p % wheel
	%$ $StrokeUnit
	Controlled { s 6 w Outer k r } if 2 w Contrast k
	-20 7 m 10 7 l 10 3 l 14 3 l
	14 1 l -16 1 l -16 3 l -20 3 l p % barrel
	4 2 m 24 -8 l 26 -8 l 18 -8 l -2 2 l % carriage
	%$ s $StrokeUnit r $FillUnit
	s Controlled { s 6 w Outer k r } if 2 w Contrast k r Paint f
	n 0 0 9 0 360 a p % wheel
	%$ $FillUnit
	Paint f
%</Sketch>

%<Act PaintLetter>
	Offset aload pop m
	MapUnitLetterFont z
	Contrast Letter h
%</Act>

	r
	end
} bd
%</Chapter>

%<Chapter DrawAlias>
/DrawAlias {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s
	3 1 roll t

%<Sketch LocateName>
	%$ $MapNameScale dup x
	.3 .3 x
	%$ $MapNameOffsetX $MapNameOffsetY t
	0 -14 t
%</Sketch>

%<Act PaintName>
	MapNameFont z
	dup stringwidth pop -2 div 0 neg m h
%</Act>

	r
} bd
%</Chapter>

%<Chapter DrawName>
/DrawName {
	pop pop pop

%<Part none/>

} bd
%</Chapter>

%<Chapter VisitTerritories /format {ustring value value} /$NumberOfScenes 0>
%<+ /define def>
/VisitTerritories {
	%$ $NumberOfScenes dict begin
	0 dict begin

%<Act Operators/>

	end
} def
%</Chapter>

%<Chapter VisitSupplies /format {uname value value} /$NumberOfScenes 0 /define>
%<+ def>
/VisitSupplies {
	%$ $NumberOfScenes dict begin
	0 dict begin

%<Act Operators/>

	end
} def
%</Chapter>

%<Chapter supply>
/supply {
	%$ $SwitchToMapMode
	SwitchToMapMode
	Power begin
	s
	t

%<Sketch LocateSupply>
	%$ $MapSupplyScale dup x
	.3 .3 x
%</Sketch>

%<Act PaintControllableSupply>
	Controlled {
		Outer
		n 0 0 8 0 360 a f
		Contrast
		n 0 0 6 0 360 a f
	} if
	Paint
	n 0 0 4 0 360 a f
%</Act>

	r
	end
} bd
%</Chapter>

%<Chapter SetArrowStateOk>
/SetArrowStateOk {

%<Act OkOrder>
	[] 0 d
%</Act>

} bd
%</Chapter>

%<Chapter OkOrder>
/OkOrder {
	/SetArrowState /SetArrowStateOk ld

%<Part none/>

} bd
%</Chapter>

%<Chapter SetArrowStateFailed>
/SetArrowStateFailed {

%<Act FailedOrder>
	[4 6] 2 d
%</Act>

} bd
%</Chapter>

%<Chapter FailedOrder>
/FailedOrder {
	/SetArrowState /SetArrowStateFailed ld

%<Part none/>

} bd
%</Chapter>

%<Chapter MovePhase /$ArrowBase $HeadLength>
/MovePhase {
	%$ /ArrowColor /$MoveColor ld
	/ArrowColor /ArrowBlack ld
	%$ /ArrowBase $ArrowBase def
	/ArrowBase 20 def
	/TraceArrowHead /TraceSingleArrowHead ld
	InTextMode not { ArrowColor } if

%<Part none/>

} bd
%</Chapter>

%<Chapter RetreatPhase /$ArrowBase { $HeadLength 2 mul $HalfThickness>
%<+ $HalfHeadThickness div sub }>
/RetreatPhase {
	%$ /ArrowColor /$RetreatColor ld
	/ArrowColor /ArrowRed ld
	%$ /ArrowBase $ArrowBase def
	/ArrowBase 39.8 def
	/TraceArrowHead /TraceDoubleArrowHead ld
	InTextMode not { ArrowColor } if

%<Part none/>

} bd
%</Chapter>

%<Chapter ProposePhase /$ArrowBase { $HeadLength 2 mul $HalfThickness>
%<+ $HalfHeadThickness div sub }>
/ProposePhase {
	%$ /ArrowColor /$ProposeColor ld
	/ArrowColor /ArrowWhite ld
	%$ /ArrowBase $ArrowBase def
	/ArrowBase 39.8 def
	/TraceArrowHead /TraceDoubleArrowHead ld
	InTextMode not { ArrowColor } if

%<Part none/>

} bd
%</Chapter>

%<Chapter TraceSingleArrowHead>
/TraceSingleArrowHead {

%<Sketch TraceSingleArrowHead>
	% draw the arrow head ...
	n
	%$ dup $HalfHeadThickness neg m
	dup -5 m
	%$ dup $HeadLength add 0 l
	dup 20 add 0 l
	%$ dup $HalfHeadThickness l
	dup 5 l
	p
%</Sketch>

} bd
%</Chapter>

%<Chapter TraceDoubleArrowHead>
/TraceDoubleArrowHead {

%<Sketch TraceDoubleArrowHead>
	% draw the double arrow head ...
	n
	%$ dup $HalfHeadThickness neg m
	dup -5 m
	%$ dup $HeadLength $HalfThickness $HalfHeadThickness div sub add
	dup 19.8 add
	%$ dup $HalfThickness neg l
	dup -1 l
	%$ dup $HalfHeadThickness neg l
	dup -5 l
	%$ dup $HeadLength add 0 l
	dup 20 add 0 l
	%$ dup $HalfHeadThickness l
	dup 5 l
	%$ $HalfThickness l
	1 l
	%$ dup $HalfHeadThickness l
	dup 5 l
	p
%</Sketch>

} bd
%</Chapter>

%<Chapter PaintArrowMove /$ArrowBase ArrowBase>
/PaintArrowMove {
	s

%<Sketch LocateArrow>
	3 index 3 index t
	3 2 roll sub 3 1 roll exch sub exch
	2 copy dup mul exch dup mul add sqrt 3 1 roll exch secure_atan
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
	o
	%$ $MapUnitScale div $ArrowBase sub
	.3 div ArrowBase sub
%</Sketch>

%<Sketch ShortenArrowTail>
	% if base of arrow is long enough, shorten it enough
	% to e.g. move arrow start beyond support circle
	%$ dup $MapUnitLetterSize gt {
	dup 14 gt {
		%$ $MapUnitLetterSize dup 0 t sub
		14 14 0 t sub
	} {
		0 t 0
	} ifelse
%</Sketch>

%<Sketch ShortenArrowTip>
	% if base is still too long, shorten it some more
	% to make arrow head touch support circle
	%$ dup $MapUnitLetterSize gt {
	dup 14 gt {
		%$ $MapUnitLetterSize sub
		14 sub
	} {
		pop 0
	} ifelse
%</Sketch>

%<Play PaintArrowMove>
	%$   $ArrowLineThickness w
	1 w

%<Part none/>

%<Act TraceArrowHead>
	TraceArrowHead
%</Act>

	k
	% now the shaft ...
	%$   $HalfThickness 2 mul w
	2 w
	0 0 m
	0 l
	k
%</Play>

	r
} bd
%</Chapter>

%<Chapter PaintArrowCircle>
/PaintArrowCircle {
	s
	5 1 roll

%<Sketch LocateArrow>
	3 index 3 index t
	3 2 roll sub 3 1 roll exch sub exch
	2 copy dup mul exch dup mul add sqrt 3 1 roll exch secure_atan
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
	o
	%$ $MapUnitScale div $ArrowBase sub
	.3 div
%</Sketch>

%<Sketch ArrowCircleBase>
	1 index sub
%</Sketch>

%<Sketch ShortenArrowTail>
	% if base of arrow is long enough, shorten it enough
	% to e.g. move arrow start beyond support circle
	%$ dup $MapUnitLetterSize gt {
	dup 14 gt {
		%$ $MapUnitLetterSize dup 0 t sub
		14 14 0 t sub
	} {
		0 t 0
	} ifelse
%</Sketch>

%<Sketch PaintArrowCircle>
	% draw the circle ...
	%$ $ArrowLineThickness w
	1 w
	n
	2 copy add 0 4 3 roll 0 360 a
	p k
	% now the shaft ...
	%$ $HalfThickness 2 mul w
	2 w
	0 0 m
	0 l
	k
%</Sketch>

	r
} bd
%</Chapter>

%<Chapter PaintArrowArrive /$ArrowRotate {180 rotate} /$ArrowBase ArrowBase>
/PaintArrowArrive {
	s

%<Sketch LocateTrailingArrow>
	t
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
	%$ $ArrowRotate $MapUnitLetterSize $ArrowShaftLength add $ArrowBase add neg 0 t
	180 rotate 54 ArrowBase add neg 0 t
	%$ $ArrowShaftLength
	40
%</Sketch>

%<Play PaintArrowMove>
	%$   $ArrowLineThickness w
	1 w

%<Part none/>

%<Act TraceArrowHead>
	TraceArrowHead
%</Act>

	k
	% now the shaft ...
	%$   $HalfThickness 2 mul w
	2 w
	0 0 m
	0 l
	k
%</Play>

	-5 0 m -10 0 l
	-15 0 m -20 0 l
	k
	r
} bd
%</Chapter>

%<Chapter PaintArrowDepart>
/PaintArrowDepart {
	s

%<Sketch LocateTrailingArrow>
	t
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
	%$ $ArrowRotate $MapUnitLetterSize $ArrowShaftLength add $ArrowBase add neg 0 t
	-54 0 t
	%$ $ArrowShaftLength
	40
%</Sketch>

%<Sketch TraceLineShaft>
	%$ $HalfThickness 2 mul w
	2 w
	0 0 m
	0 l
%</Sketch>

	-6 0 m -10 0 l
	-16 0 m -20 0 l
	k
	r
} bd
%</Chapter>

%<Chapter ArrowMove>
/ArrowMove {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s
	SetArrowState

%<Part none/>

	PaintArrowMove
	r
} bd
%</Chapter>

%<Chapter ArrowHold>
/ArrowHold {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s
	SetArrowState

%<Part none/>

	%$ $HoldRadius PaintArrowCircle
	24 PaintArrowCircle
	r
} bd
%</Chapter>

%<Chapter ArrowSupport>
/ArrowSupport {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s
	SetArrowState

%<Part none/>

	center
	%$ $MoveRadius PaintArrowCircle
	8 PaintArrowCircle
	r
} bd
%</Chapter>

%<Chapter ArrowConvoy>
/ArrowConvoy {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s
	SetArrowState

%<Part none/>

	center
	%$ $ConvoyRadius PaintArrowCircle
	12 PaintArrowCircle
	r
} bd
%</Chapter>

%<Chapter ArrowArrive>
/ArrowArrive {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s
	SetArrowState

%<Part none/>

	PaintArrowArrive
	r
} bd
%</Chapter>

%<Chapter ArrowDepart>
/ArrowDepart {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s
	SetArrowState

%<Part none/>

	PaintArrowDepart
	r
} bd
%</Chapter>

%<Chapter ArrowRetreat>
/ArrowRetreat {
	RetreatPhase
	ArrowMove
	MovePhase

%<Part none/>

} bd
%</Chapter>

%<Chapter ArrowPropose>
/ArrowPropose {
	ProposePhase
	ArrowMove
	MovePhase

%<Part none/>

} bd
%</Chapter>

%<Chapter ArrowRetreatArrive>
/ArrowRetreatArrive {
	RetreatPhase
	ArrowArrive
	MovePhase

%<Part none/>

} bd
%</Chapter>

%<Chapter ArrowRetreatDepart>
/ArrowRetreatDepart {
	RetreatPhase
	ArrowDepart
	MovePhase

%<Part none/>

} bd
%</Chapter>

%<Chapter BuildUnit>
/BuildUnit {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s
	t
	%$ $BuildColor
	ArrowWhite

%<Sketch LocateTroop>
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
%</Sketch>

%<Sketch PaintBuildCircle /$BuildDashStart {$BuildRayLength 2 div}>
%<+ /$BuildSpaceLength {$BuildDashLength 1 $BuildRayFraction sub mul}>
%<+ /$BuildRayLength {$BuildDashLength $BuildRayFraction mul} /$BuildDashLength>
%<+ { $Pi 2 mul $BuildRadius mul $BuildRays div }>
	%$ $BuildRayThickness w [ $BuildRayLength# $BuildSpaceLength# ] $BuildDashStart# d
	6 w [ 3.14 6.28 ] 1.57 d
	n
	%$ 0 0 $BuildRadius 0 360 a
	0 0 24 0 360 a
	p k
%</Sketch>

	r
} bd
%</Chapter>

%<Chapter SlashUnit>
/SlashUnit {
	s
	3 1 roll t

%<Sketch LocateTroop>
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
%</Sketch>

%<Sketch TraceSlash>
	n
	%$ $HalfSlashThickness neg $HalfSlashLength sub $HalfSlashLength neg m
	-21 -16 m
	%$ $HalfSlashThickness neg $HalfSlashLength add $HalfSlashLength l
	11 16 l
	%$ $HalfSlashThickness $HalfSlashLength add $HalfSlashLength l
	21 16 l
	%$ $HalfSlashThickness $HalfSlashLength sub $HalfSlashLength neg l
	-11 -16 l
	p
%</Sketch>

	exec
	r
} bd
%</Chapter>

%<Chapter DestroyUnit>
/DestroyUnit {
	%$ $SwitchToMapMode
	SwitchToMapMode
	%$ { $RetreatColor f } SlashUnit
	{ ArrowRed f } SlashUnit

%<Part none/>

} bd
%</Chapter>

%<Chapter DisbandUnit>
/DisbandUnit {
	%$ $SwitchToMapMode
	SwitchToMapMode
	%$ { s $BuildColor f r $ArrowLineThickness w $RetreatColor k } SlashUnit
	{ s ArrowWhite f r 1 w ArrowRed k } SlashUnit

%<Part none/>

} bd
%</Chapter>

%<Chapter RemoveUnit>
/RemoveUnit {
	%$ $SwitchToMapMode
	SwitchToMapMode
	%$ { $BuildColor f } SlashUnit
	{ ArrowWhite f } SlashUnit

%<Part none/>

} bd
%</Chapter>

%<Chapter FindUnit>
/FindUnit {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s
	t
	%$ $DiscoverColor
	ArrowBlue

%<Sketch LocateTroop>
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
%</Sketch>

%<Sketch PaintBuildCircle /$BuildDashStart {$BuildRayLength 2 div}>
%<+ /$BuildSpaceLength {$BuildDashLength 1 $BuildRayFraction sub mul}>
%<+ /$BuildRayLength {$BuildDashLength $BuildRayFraction mul} /$BuildDashLength>
%<+ { $Pi 2 mul $BuildRadius mul $BuildRays div }>
	%$ $BuildRayThickness w [ $BuildRayLength# $BuildSpaceLength# ] $BuildDashStart# d
	6 w [ 3.14 6.28 ] 1.57 d
	n
	%$ 0 0 $BuildRadius 0 360 a
	0 0 24 0 360 a
	p k
%</Sketch>

	r
} bd
%</Chapter>

%<Chapter LoseUnit>
/LoseUnit {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s
	t
	%$ $DiscoverColor
	ArrowBlue

%<Sketch LocateTroop>
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
%</Sketch>

%<Sketch PaintFogWave>
	%$ $FogWaveThickness w
	4 w
	%$ $FogWaveLength neg $FogWaveDistance 2 div m
	-12 4 m
	%$ $FogWaveLength neg $FogWaveRaiseLength add $FogWaveDistance 2 div $FogWaveRaiseHeight add $FogWaveRaiseLength neg $FogWaveDistance 2 div $FogWaveRaiseHeight add 0 $FogWaveDistance 2 div c
	-8 7 -4 7 0 4 c
	%$ $FogWaveRaiseLength $FogWaveDistance 2 div $FogWaveRaiseHeight sub $FogWaveLength $FogWaveRaiseLength sub $FogWaveDistance 2 div $FogWaveRaiseHeight sub $FogWaveLength $FogWaveDistance 2 div c
	4 1 8 1 12 4 c
	%$ $FogWaveLength neg $FogWaveDistance 2 div neg m
	-12 -4 m
	%$ $FogWaveLength neg $FogWaveRaiseLength add $FogWaveDistance 2 div neg $FogWaveRaiseHeight add $FogWaveRaiseLength neg $FogWaveDistance 2 div neg $FogWaveRaiseHeight add 0 $FogWaveDistance 2 div neg c
	-8 -1 -4 -1 0 -4 c
	%$ $FogWaveRaiseLength $FogWaveDistance 2 div neg $FogWaveRaiseHeight sub $FogWaveLength $FogWaveRaiseLength sub $FogWaveDistance 2 div neg $FogWaveRaiseHeight sub $FogWaveLength $FogWaveDistance 2 div neg c
	4 -7 8 -7 12 -4 c
	k
%</Sketch>

	r
} bd
%</Chapter>

%<Chapter QueryUnit>
/QueryUnit {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s
	t
	%$ $ProposeColor
	ArrowWhite

%<Sketch LocateTroop>
	%$ $MapUnitScale dup x
	.3 .3 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
%</Sketch>

%<Sketch PaintFogWave>
	%$ $FogWaveThickness w
	4 w
	%$ $FogWaveLength neg $FogWaveDistance 2 div m
	-12 4 m
	%$ $FogWaveLength neg $FogWaveRaiseLength add $FogWaveDistance 2 div $FogWaveRaiseHeight add $FogWaveRaiseLength neg $FogWaveDistance 2 div $FogWaveRaiseHeight add 0 $FogWaveDistance 2 div c
	-8 7 -4 7 0 4 c
	%$ $FogWaveRaiseLength $FogWaveDistance 2 div $FogWaveRaiseHeight sub $FogWaveLength $FogWaveRaiseLength sub $FogWaveDistance 2 div $FogWaveRaiseHeight sub $FogWaveLength $FogWaveDistance 2 div c
	4 1 8 1 12 4 c
	%$ $FogWaveLength neg $FogWaveDistance 2 div neg m
	-12 -4 m
	%$ $FogWaveLength neg $FogWaveRaiseLength add $FogWaveDistance 2 div neg $FogWaveRaiseHeight add $FogWaveRaiseLength neg $FogWaveDistance 2 div neg $FogWaveRaiseHeight add 0 $FogWaveDistance 2 div neg c
	-8 -1 -4 -1 0 -4 c
	%$ $FogWaveRaiseLength $FogWaveDistance 2 div neg $FogWaveRaiseHeight sub $FogWaveLength $FogWaveRaiseLength sub $FogWaveDistance 2 div neg $FogWaveRaiseHeight sub $FogWaveLength $FogWaveDistance 2 div neg c
	4 -7 8 -7 12 -4 c
	k
%</Sketch>

	r
} bd
%</Chapter>

%<Chapter SplitString>
/SplitString {

%<Sketch SplitString>
	7 dict begin
	/nrChars xd
	/indentString xd
	/objectString xd
	/objectLast objectString length 1 sub def
	% Short string?
	objectLast nrChars lt {
		false objectString
	} {
		% Look for a suitable place to split.
		% First tracking backwards, if that doesn't work, look forward.
		/splitIndex -1 def
		nrChars -1 0 {
			%$ objectString 1 index get $SpaceChar eq {
			objectString 1 index get 32 eq {
				/splitIndex xd exit
			} if pop
		} for splitIndex -1 eq {
			nrChars 1 add 1 objectLast {
				%$ objectString 1 index get $SpaceChar eq {
				objectString 1 index get 32 eq {
					/splitIndex xd exit
				} if pop
			} for
		} if
		splitIndex -1 eq splitIndex objectLast eq or {
			false objectString
		} {
			% The first part.
			objectString 0 splitIndex getinterval
			% The second part.
			objectString splitIndex 1 add objectLast splitIndex sub getinterval
			% Add indentation if needed.
			indentString length 0 gt {
				dup length indentString length add string
				dup 0 indentString putinterval
				dup indentString length 4 3 roll putinterval
			} if
			% Add white space of the first part.
			/nonSpaceIndex objectLast 1 add def
			0 1 objectLast {
				%$ objectString 1 index get $SpaceChar ne {
				objectString 1 index get 32 ne {
					/nonSpaceIndex xd exit
				} if pop
			} for
			nonSpaceIndex 0 gt nonSpaceIndex splitIndex lt and {
				dup length nonSpaceIndex add string
				dup 0 objectString 0 nonSpaceIndex getinterval putinterval
				dup nonSpaceIndex 4 3 roll putinterval
			} if
			exch true exch
		} ifelse
	} ifelse
	end
%</Sketch>

} bd
%</Chapter>

%<FrameLayout PageLayout /$SetTextFont {TextFixedFont $TextFontSize# y z}>
%<+ /references { Map { ImageGrid ImageFrame Image } { Left Bottom Width Height>
%<+ ImageScale FrameLeft FrameBottom FrameWidth FrameHeight } } /layout>
%<+ ImageGrid /$MapImageScale 2.35983264 /marginWidth 20 /$MapBottom 24 /height>
%<+ $PageHeight /$TextFontSize 8 /$MapLeft 147.0376569 /marginHeight 20 /type>
%<+ proc /width $PageWidth /fitWidth 1 /define bd /fitHeight 1>
%<+ /$ClipAndTransformToMap { $MapImageScale#4 dup x>
%<+ {$MapLeft $MapImageScale div $MapImageLeft sub}#>
%<+ {$MapBottom $MapImageScale div $MapImageBottom sub}# t }>

%<Chapter DrawLayoutBorders>
/DrawLayoutBorders {
	s
	%$ $SetTextFont
	TextFixedFont 8 y z

%<Part none/>

	r
} bd
%</Chapter>

%<GridLayout ImageGrid /cellWidth $TextFontWidth /cellHeight $TextFontHeight>
%<+ /fitWidth 2 /fitHeight 2 /layout ImageFrame>

%<FrameLayout ImageFrame /marginWidth $FrameMargin /fitWidth 2 /fitHeight 2>
%<+ /layout Image /marginHeight $FrameMargin>

%<ImageLayout Image /widthPriority 5 /imageWidth $MapImageWidth /imageHeight>
%<+ $MapImageHeight /heightPriority 5>
%</ImageLayout>

%</FrameLayout>

%</GridLayout>

%<Chapter OwnerReport>
/OwnerReport {

%<Part none/>

} bd
%</Chapter>

%<Chapter WriteOwner>
/WriteOwner {
	pop

%<Part none/>

} bd
%</Chapter>

%<Chapter AdjustReport>
/AdjustReport {

%<Part none/>

} bd
%</Chapter>

%<Chapter WriteAdjust>
/WriteAdjust {
	pop

%<Part none/>

} bd
%</Chapter>

%<Chapter RetreatReport>
/RetreatReport {

%<Part none/>

} bd
%</Chapter>

%<Chapter WriteRetreat>
/WriteRetreat {
	pop

%<Part none/>

} bd
%</Chapter>

%<Chapter OrderReport>
/OrderReport {

%<Part none/>

} bd
%</Chapter>

%<Chapter WriteOrder>
/WriteOrder {
	pop

%<Part none/>

} bd
%</Chapter>

%<Chapter DrawTitle>
/DrawTitle {
	pop

%<Part none/>

} bd
%</Chapter>

%<Chapter SwitchToTextMode>
/SwitchToTextMode {
	InTextMode {
		FinishReport /FinishReport { } def
	} {
		r /InTextMode true def
	} ifelse

%<Part none/>

} bd
%</Chapter>

%<Chapter SwitchToMapMode>
/SwitchToMapMode {
	InTextMode {
		FinishReport /FinishReport { } def
		/InTextMode false def
		s
		%$ $ClipAndTransformToMap
		2.3598 2.3598 x 62.31 10.17 t
		ArrowColor
		OkOrder
	} if

%<Part none/>

} bd
%</Chapter>

%</FrameLayout>

%<Chapter PaintMap>
/PaintMap {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s

%<Act PaintOutlines>
	IncludeKnight
%</Act>

	r
} bd
%</Chapter>

%<Chapter DrawMap>
/DrawMap {
	PageSetup
	PaintMap
	NumberLocations

%<Part none/>

} bd
%</Chapter>

%<Chapter DrawAliases>
/DrawAliases {

%<Part none/>

} bd
%</Chapter>

%<Chapter PrintNumber>
/PrintNumber {

%<Sketch PrintNumber>
	n
	%$ $MaxNumberLength string cvs dup 4 1 roll 0 0 m true charpath pathbbox n
	4 string cvs dup 4 1 roll 0 0 m true charpath pathbbox n
	3 -1 roll add 2 div 3 1 roll add 2 div exch
	3 -1 roll sub neg 3 1 roll sub exch m h
%</Sketch>

} bd
%</Chapter>

%<Chapter NumberLocations>
/NumberLocations {
	%$ $SwitchToMapMode
	SwitchToMapMode
	3 dict begin
	/bn 1 def /en /pop ld
	/nr { 2 index PrintNumber 1 add } bd
	s
	%$ MapNumberFont $MapNumberScale y z
	MapNumberFont .3 y z

%<Play Dots>
	Blue bn

%<Scene Numbers /operator nr /format {value value}>
	139 169 nr
	127 165.5 nr
	142 160 nr
	154 159 nr
	127 158 nr
	3 154 nr
	136 153 nr
	133 150 nr
	129 148 nr
	144 146 nr
	129 144 nr
	107 142 nr
	123 141 nr
	95 137 nr
	105 136 nr
	88 136 nr
	146 135 nr
	129 135 nr
	153 133 nr
	82 132 nr
	132 131 nr
	118 129 nr
	72 127 nr
	131.5 126 nr
	67 124 nr
	161 123 nr
	129 122 nr
	121 118 nr
	92 115 nr
	85 115 nr
	70 115 nr
	77 111 nr
	82 106 nr
	166 97 nr
	78 94 nr
	199 93 nr
	192 91 nr
	203 90 nr
	173 86 nr
	78 84 nr
	181 80 nr
	204 78 nr
	75 78 nr
	76 71 nr
	210 69 nr
	185 63 nr
	56 61 nr
	206 60 nr
	195 59 nr
	79 56 nr
	54 55 nr
	177 54 nr
	66 54 nr
	195 52 nr
	205 49 nr
	111 49 nr
	96 49 nr
	142 48 nr
	134 48 nr
	63 47 nr
	177 46 nr
	156 42 nr
	115 42 nr
	192 41 nr
	86 39 nr
	184 38 nr
	199 37 nr
	170 37 nr
	148 36 nr
	77 36 nr
	62 34 nr
	80 33 nr
	158 31 nr
	198 28 nr
	179 25 nr
	81 25 nr
	74 25 nr
	174 23 nr
	135 22 nr
	140 18 nr
	100 18 nr
	91 17 nr
	179 12 nr
	168 12 nr
	94 12 nr
	84 11 nr
	141 10 nr
	130 9 nr
	174 8 nr
	162 7 nr
	135 5 nr
	172 3 nr
	162 3 nr
	93 3 nr
	79 3 nr
%</Scene>

	en
%</Play>

	r
	end
} bd
%</Chapter>

%<Chapter IncludeKnight>
/IncludeKnight {
	s
	/fk {
		p
		s Yellow f r
		k
	} bd
	%$ {10 $MapDrawingScale mul}# w Black
	3 w Black
	ShapeContour

%<Part none/>

	r
} bd
%</Chapter>

%</Play>

%<Play Outlines /define bd/>

%<Play Shapes /define bd>

%<Chapter ShapeContour>
/ShapeContour {
	172 3 m
	174 8 l
	179 12 l
	179 25 l
	184 38 l
	177 46 l
	177 54 l
	185 63 l
	195 59 l
	195 52 l
	192 41 l
	198 28 l
	199 37 l
	205 49 l
	206 60 l
	210 69 l
	204 78 l
	203 90 l
	199 93 l
	192 91 l
	181 80 l
	173 86 l
	166 97 l
	161 123 l
	153 133 l
	146 135 l
	144 146 l
	136 153 l
	142 160 l
	154 159 l
	139 169 l
	127 166 l
	127 158 l
	133 150 l
	129 148 l
	129 144 l
	123 141 l
	129 135 l
	132 131 l
	132 126 l
	129 122 l
	121 118 l
	118 129 l
	105 136 l
	107 142 l
	95 137 l
	88 136 l
	82 132 l
	72 127 l
	67 124 l
	70 115 l
	77 111 l
	85 115 l
	92 115 l
	82 106 l
	78 94 l
	78 84 l
	75 78 l
	76 71 l
	56 61 l
	54 55 l
	62 34 l
	74 25 l
	81 25 l
	80 33 l
	77 36 l
	63 47 l
	66 54 l
	79 56 l
	86 39 l
	91 17 l
	84 11 l
	79 3 l
	93 3 l
	94 12 l
	100 18 l
	96 49 l
	111 49 l
	115 42 l
	134 48 l
	142 48 l
	148 36 l
	135 22 l
	130 9 l
	135 5 l
	141 10 l
	140 18 l
	158 31 l
	156 42 l
	170 37 l
	174 23 l
	168 12 l
	162 7 l
	162 3 l
	fk

%<Part none/>

} bd
%</Chapter>

%</Play>

%<Play Installations>

%<Act DefineColors>
{
	currentdict end 3 1 roll [ exch /setgray load ] cvx def begin
}{
	currentdict end 5 1 roll [ 4 1 roll /setrgbcolor load ] cvx def begin
}{
	currentdict end 6 1 roll [ 5 1 roll /setcmykcolor load ] cvx def begin
} bind VisitColors
%</Act>

%<Sketch DefinePowers /$InitController {/ChangeController false def} /$Push {}>
%<+ /$AddController { dup /Controlled ChangeController put ChangeController {>
%<+ dup /Outer Power /Paint get put /ChangeController false def } if } /$Pull {>
%<+ } /$CreatePowerDict { 4 dict begin /Contrast xd /Paint xd /Offset xd>
%<+ /Letter xd currentdict end } /$GetLetterOffset { [ exch n 0 0 m true>
%<+ charpath pathbbox 3 2 roll add -2 div 3 1 roll add -2 div exch ] }>
s
MapUnitLetterFont z
{
	%$ $Push exch load exch load
	exch load exch load
	%$ 2 index $GetLetterOffset 3 1 roll $Pull
	2 index [ exch n 0 0 m true charpath pathbbox 3 2 roll add -2 div 3 1 roll add -2 div exch ] 3 1 roll
	%$ $CreatePowerDict
	4 dict begin /Contrast xd /Paint xd /Offset xd /Letter xd currentdict end
	%$ [ /Power 3 2 roll { $AddController } /exec load /def load ] cvx
	[ /Power 3 2 roll { dup /Controlled ChangeController put ChangeController { dup /Outer Power /Paint get put /ChangeController false def } if } /exec load /def load ] cvx
	currentdict end 3 1 roll def begin
} VisitPowers
r
%$ $InitController
/ChangeController false def
%</Sketch>

%<Scene Centers /operator ld /format {uname uname}>
/UNOWNEDCENTER /UNOWNED ld
%</Scene>

%</Play>

%</Play>
%%EndSetup

%%Page: Opening 1
%<Play Page>
DrawMap

%<Part none/>

ShowPage
%</Play>

%%Trailer
%%Pages: 1
